
/**
 * Project Name:cats-core
 * File Name:Menu.java
 * Package Name:com.catsic.core.entity
 * Date:2014年3月17日上午10:55:39
 * Copyright (c) 2014, oa.catsic.com All Rights Reserved.
 */
 
package com.catsic.core.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.catsic.base.tree.TreeImpl;
import com.catsic.pub.entity.Drawer;

/**
 * ClassName: Menu
 * Description: 菜单实体类
 * date: 2014年3月17日 上午10:55:39
 * author: yangyd
 */
@Entity
@Table(name="S_MENU")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Menu extends TreeImpl<Menu> implements Serializable{

	private static final long serialVersionUID = 7462938636404556115L;
	
	/**
	 * level:级别
	 */
	@Column(name="LEVELE",nullable=false)
	private Integer level;
	
	/**
	 * path:path路径
	 */
	@Column(name="PATH")
	private String path;
	
	/**
	 * sort:sort显示顺序
	 */
	@Column(name="SORTS")
	private Integer sort;
	
	/**
	 * icon:图标
	 */
	@Column(name="ICON")
	private String icon; 
	
	/**
	 * drawer:显示区域
	 */
	@ManyToOne(fetch = FetchType.EAGER, optional = false)
	@JoinColumn(name = "DISPLAYAREA", referencedColumnName = "CODE")
	private Drawer displayArea;
	
	/**
	 * systemType:系统类型，admin：PC端后台维护系统，
	 * site：PC端前台网站，mobile手机端，wechat微信
	 * ipad：IPAD端
	 */
	@ManyToOne(fetch = FetchType.EAGER, optional = false)
	@JoinColumn(name = "SYSTEMTYPE", referencedColumnName = "CODE")
	private Drawer systemType;
	
	/**
	 * resources:行为
	 */
	@OneToMany(cascade=CascadeType.REMOVE,fetch = FetchType.LAZY,mappedBy = "menu") 
    private List<Resource> resources;

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Drawer getDisplayArea() {
		return displayArea;
	}

	public void setDisplayArea(Drawer displayArea) {
		this.displayArea = displayArea;
	}

	public List<Resource> getResources() {
		return resources;
	}

	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}

	public Drawer getSystemType() {
		return systemType;
	}

	public void setSystemType(Drawer systemType) {
		this.systemType = systemType;
	}
}
